/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package edu.cmu.mism.dgjava.data.models.option.impl;

import edu.cmu.mism.dgjava.data.models.option.ImplicitFiniteDifference;
import edu.cmu.mism.dgjava.data.models.option.OptionModelPackage;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Implicit Finite Difference</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link edu.cmu.mism.dgjava.data.models.option.impl.ImplicitFiniteDifferenceImpl#getMaxPrice <em>Max Price</em>}</li>
 *   <li>{@link edu.cmu.mism.dgjava.data.models.option.impl.ImplicitFiniteDifferenceImpl#getTimeIntervals <em>Time Intervals</em>}</li>
 *   <li>{@link edu.cmu.mism.dgjava.data.models.option.impl.ImplicitFiniteDifferenceImpl#getPriceIntervals <em>Price Intervals</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ImplicitFiniteDifferenceImpl extends AmericanTypeImpl implements ImplicitFiniteDifference {
	/**
	 * The default value of the '{@link #getMaxPrice() <em>Max Price</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMaxPrice()
	 * @generated
	 * @ordered
	 */
	protected static final double MAX_PRICE_EDEFAULT = 0.0;
	/**
	 * The cached value of the '{@link #getMaxPrice() <em>Max Price</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMaxPrice()
	 * @generated
	 * @ordered
	 */
	protected double maxPrice = MAX_PRICE_EDEFAULT;
	/**
	 * The default value of the '{@link #getTimeIntervals() <em>Time Intervals</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTimeIntervals()
	 * @generated
	 * @ordered
	 */
	protected static final int TIME_INTERVALS_EDEFAULT = 0;
	/**
	 * The cached value of the '{@link #getTimeIntervals() <em>Time Intervals</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTimeIntervals()
	 * @generated
	 * @ordered
	 */
	protected int timeIntervals = TIME_INTERVALS_EDEFAULT;
	/**
	 * The default value of the '{@link #getPriceIntervals() <em>Price Intervals</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPriceIntervals()
	 * @generated
	 * @ordered
	 */
	protected static final int PRICE_INTERVALS_EDEFAULT = 0;
	/**
	 * The cached value of the '{@link #getPriceIntervals() <em>Price Intervals</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPriceIntervals()
	 * @generated
	 * @ordered
	 */
	protected int priceIntervals = PRICE_INTERVALS_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ImplicitFiniteDifferenceImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return OptionModelPackage.Literals.IMPLICIT_FINITE_DIFFERENCE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public double getMaxPrice() {
		return maxPrice;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setMaxPrice(double newMaxPrice) {
		double oldMaxPrice = maxPrice;
		maxPrice = newMaxPrice;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, OptionModelPackage.IMPLICIT_FINITE_DIFFERENCE__MAX_PRICE, oldMaxPrice, maxPrice));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getTimeIntervals() {
		return timeIntervals;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setTimeIntervals(int newTimeIntervals) {
		int oldTimeIntervals = timeIntervals;
		timeIntervals = newTimeIntervals;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, OptionModelPackage.IMPLICIT_FINITE_DIFFERENCE__TIME_INTERVALS, oldTimeIntervals, timeIntervals));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getPriceIntervals() {
		return priceIntervals;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setPriceIntervals(int newPriceIntervals) {
		int oldPriceIntervals = priceIntervals;
		priceIntervals = newPriceIntervals;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, OptionModelPackage.IMPLICIT_FINITE_DIFFERENCE__PRICE_INTERVALS, oldPriceIntervals, priceIntervals));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case OptionModelPackage.IMPLICIT_FINITE_DIFFERENCE__MAX_PRICE:
				return getMaxPrice();
			case OptionModelPackage.IMPLICIT_FINITE_DIFFERENCE__TIME_INTERVALS:
				return getTimeIntervals();
			case OptionModelPackage.IMPLICIT_FINITE_DIFFERENCE__PRICE_INTERVALS:
				return getPriceIntervals();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case OptionModelPackage.IMPLICIT_FINITE_DIFFERENCE__MAX_PRICE:
				setMaxPrice((Double)newValue);
				return;
			case OptionModelPackage.IMPLICIT_FINITE_DIFFERENCE__TIME_INTERVALS:
				setTimeIntervals((Integer)newValue);
				return;
			case OptionModelPackage.IMPLICIT_FINITE_DIFFERENCE__PRICE_INTERVALS:
				setPriceIntervals((Integer)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case OptionModelPackage.IMPLICIT_FINITE_DIFFERENCE__MAX_PRICE:
				setMaxPrice(MAX_PRICE_EDEFAULT);
				return;
			case OptionModelPackage.IMPLICIT_FINITE_DIFFERENCE__TIME_INTERVALS:
				setTimeIntervals(TIME_INTERVALS_EDEFAULT);
				return;
			case OptionModelPackage.IMPLICIT_FINITE_DIFFERENCE__PRICE_INTERVALS:
				setPriceIntervals(PRICE_INTERVALS_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case OptionModelPackage.IMPLICIT_FINITE_DIFFERENCE__MAX_PRICE:
				return maxPrice != MAX_PRICE_EDEFAULT;
			case OptionModelPackage.IMPLICIT_FINITE_DIFFERENCE__TIME_INTERVALS:
				return timeIntervals != TIME_INTERVALS_EDEFAULT;
			case OptionModelPackage.IMPLICIT_FINITE_DIFFERENCE__PRICE_INTERVALS:
				return priceIntervals != PRICE_INTERVALS_EDEFAULT;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (maxPrice: ");
		result.append(maxPrice);
		result.append(", timeIntervals: ");
		result.append(timeIntervals);
		result.append(", priceIntervals: ");
		result.append(priceIntervals);
		result.append(')');
		return result.toString();
	}

} //ImplicitFiniteDifferenceImpl
